package com.gxa.springcloud251.eurekaService03.controller;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class DefaultController {
    /*
     * 这里需要注意的是，springcloud默认返回xml文件，这点不同于springboot，
     * 如果希望修改返回json格式，则需要在RequestMapping中添加produces = MediaType.APPLICATION_JSON_VALUE
     */
    @RequestMapping(value = "/show",method = {RequestMethod.GET, RequestMethod.POST},
            produces = MediaType.APPLICATION_JSON_VALUE)
    public Map check(@RequestParam String name) {
        Map map = new HashMap();
        map.put("code",200);
        map.put("msg","success8762");
        map.put("name",name);
        return map;
    }
}